/**
 * @file
 * Vertex and edge class with a string as the data payload.
 */

#include "string_vertex_edge.h"

std::map<std::string, int> StringVertexEdge::label_store;
int StringVertexEdge::label_count = 0;

StringVertexEdge::StringVertexEdge(int id, std::string data) : id_(id), data_(data) 
{ 
  if (label_store.find(data) == label_store.end())
      label_store.insert(std::pair<std::string, int>(data, ++label_count));    
} 

int StringVertexEdge::get_int_value()
{ 
  return (label_store.find(data_))->second;
} 

/**
 * The @c == operator for StringVertexEdge @c class. 
 * param[in] v1 The first StringVertexEdge instance.
 * param[in] v2 The other StringVertexEdge instance.
 * @return @c true if equal, false otherwise.
 */
bool operator==(StringVertexEdge &v1, StringVertexEdge &v2)
{
  return v1.data_ == v2.data_;
}
